package com.example.card.implemention;

import com.example.card.Util;

import java.time.LocalDate;

public class LimitConsumptionDate {

    private final LocalDate startDate;
    private final LocalDate endDate;
    private final int limitValue;


    public LimitConsumptionDate(LocalDate startDate, LocalDate endDate, int limitValue) {
        this.startDate = startDate;
        this.endDate = endDate;
        this.limitValue = limitValue;
    }


    public boolean outLimit(int amount) {
        return limitValue < amount;
    }

    public boolean inPeriod() {
        if (startDate == null || endDate == null) {
            return false;
        }
        return Util.inPeriod(LocalDate.now(), startDate, endDate);
    }

    public int getLimitValue() {
        return limitValue;
    }

    public LocalDate getStartDate() {
        return startDate;
    }

    public LocalDate getEndDate() {
        return endDate;
    }
}
